package jeye.client.util;

public class URLBuilder {
	
	private StringBuffer stringBuffer = new StringBuffer();
	
	private boolean firstAppendant = true;

	public URLBuilder(String connectionURL) {
		stringBuffer.append(connectionURL);
	}
	
	public URLBuilder addParameter(String key, Object value) {
		if(firstAppendant) {
			firstAppendant = false;
			stringBuffer.append("?");
		}
		else {
			stringBuffer.append("&");
		}
		
		stringBuffer.append(key).append("=").append(value);
		
		return this;
	}
	
	public String toString() {
		return stringBuffer.toString();
	}
}
